Skip to content

Conversation

Karan-Palan
Copy link
Contributor

The rule removes:

  • String enum with numeric validation keywords
  • Numeric enum with string validation keywords
  • Object enum with mixed inapplicable validation keywords

@Karan-Palan Karan-Palan marked this pull request as ready for review July 28, 2025 09:41
@Karan-Palan
Copy link
Contributor Author

@jviotti any comments?

"minimum": 10,
"minLength": 2,
"minItems": 1,
"minProperties": 1,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your tests, mainly for older versions, are not considering the fact that many of these keywords do not exist in such older versions. For example, minProperties is only present in Draft 4.

The test works because in Draft 0, minProperties is not considered to be a keyword, therefore it applies to "any" type.

However, to make the tests cleaner, can you double check that you are not using any seemingly valid keyword on a Draft version that doesn't actually define it?

To test the above case, we can also have specific new tests that have a non-sense x-foo-bar keyword or something like that, and ensure it doesn't get removed

@Karan-Palan Karan-Palan requested a review from jviotti August 28, 2025 11:17
const sourcemeta::core::SchemaWalker &walker,
const sourcemeta::core::SchemaResolver &) const
-> sourcemeta::core::SchemaTransformRule::Result override {
if (!contains_any(vocabularies,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use the new ONLY_CONTINUE_IF for every return false?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's nice!

return false;
}

return APPLIES_TO_POINTERS(std::move(positions));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Signed-off-by: karan-palan <[email protected]>
@jviotti jviotti merged commit 24a794e into sourcemeta:main Aug 29, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants